package com.hengxinguotong.zhihuichengjian.ui.app;

import android.app.Application;
import android.content.Context;

import com.hengxinguotong.zhihuichengjian.net.HttpRequest;

import javax.inject.Singleton;

import dagger.Binds;
import dagger.Module;
import dagger.Provides;

/**
 * TODO
 *
 * @author hjz
 * @version V1.0.0
 * @since 2018/12/22 11:32
 */

@Module
public abstract class AppModule
{
    /**
     * 将应用程序作为上下文绑定
     *
     * @param application
     * @return android.content.Context
     * @author hjz
     * @since 2018/12/22 13:10
     */
    @Binds
    abstract Context bindContext(Application application);


    /**
     * 提供HttpRequest请求对象
     *
     * @param context
     * @return com.hengxinguotong.hxgtwyglj.net.HttpRequest
     * @author hjz
     * @since 2018/12/22 13:31
     */
    @Singleton
    @Provides
    static HttpRequest providesHttpRequest(Context context)
    {
        return new HttpRequest(context);
    }
}
